const MyStream = require('./stream');
const http = require('http');


let myStream = new MyStream('node.js');

http.get('http://chenzhongtao.cn', function (res) {
    res.pipe(myStream);
})

myStream.on('total', function (count) {
    console.log('test:', count);
})

/* let MyStream = require('./stream');
let str = new MyStream('百度');

let https = require('https');
let url = 'https://www.baidu.com'

https.get(url, function (res) {
    res.pipe(str);
});

str.on('total', function (count) {
    console.log(str.matchText,'被匹配次数:', count);
}) */